/**
 * Created by BigBi on 2017/4/10.
 */
var fs = require("fs");

// 创建一个可读流
var readerStream = fs.createReadStream('test.txt');

// 创建一个可写流
var writerStream = fs.createWriteStream('output.txt');

// 管道读写操作
// 读取 input.txt 文件内容，并将内容写入到 output.txt 文件中
readerStream.pipe(writerStream);

readerStream.on('end',function(){
    console.log('数据读取完毕');
});

writerStream.on('finish',function(){
    console.log('数据写入完毕');
});

console.log("程序执行完毕");